package root.electronclass.electronclass.grade.honor

import android.os.Bundle
import android.view.View
import root.electronclass.electronclass.common.base.ViewBindingFragment
import root.electronclass.electronclass.R
import root.electronclass.electronclass.databinding.FragmentClassHonorDetailBinding
import root.electronclass.electronclass.grade.model.ClassHonor

/**
 *
 * @author Lokiy
 * @date 2023/3/17 21:58
 */
class ClassHonorDetailFragment : ViewBindingFragment<FragmentClassHonorDetailBinding>() {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val honor: ClassHonor = arguments?.getParcelable(EXTRA_DATA) ?: return
        binding.title.text = honor.title
        binding.itemDate.text = honor.time
        binding.itemName.text = honor.userList?.joinToString("，") ?: honor.belong
        binding.itemOrg.text = honor.org
        binding.itemReason.text = honor.reason
        binding.itemAvatar.setImageURI(honor.picList?.getOrNull(0)?.url)
        binding.itemType.setText(if (honor.type == 2) R.string.class_honor_team else R.string.class_honor_person)
    }
}